using System.Collections.Generic;

namespace WB.Mvc.Forms
{
	public class AttributeDictionaryBuilder
	{
		private readonly IDictionary<string, object> dict;

		protected AttributeDictionaryBuilder() : this(new Dictionary<string, object>())
		{
		}

		protected AttributeDictionaryBuilder(IDictionary<string, object> dictionary)
		{
			dict = dictionary;
		}

		public static AttributeDictionaryBuilder New()
		{
			return new AttributeDictionaryBuilder();
		}

		public AttributeDictionaryBuilder Add(string attrib, object value)
		{
			dict.Add(attrib, value);
			return this;
		}

		public AttributeDictionaryBuilder Remove(string attrib)
		{
			dict.Remove(attrib);
			return this;
		}

		public IDictionary<string, object> ToDictionary()
		{
			return dict;
		}

		public static AttributeDictionaryBuilder From(IDictionary<string, object> dictionary)
		{
			return new AttributeDictionaryBuilder();
		}
	}
}